package com.example.dql.diary.activity;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.widget.ImageView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.example.dql.diary.Model.ImageDTO;
import com.example.dql.diary.R;

public class MyRecycleActivity extends AppCompatActivity {
private ImageView buttonBack;
private RecyclerView recyclerView ;
private RecycleAdapter adapter;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_my_recycle);
        buttonBack = (ImageView)findViewById(R.id.button_back);
        recyclerView = (RecyclerView)findViewById(R.id.recyclerView);
        buttonBack.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                finish();
            }
        });

        LinearLayoutManager layoutManager = new LinearLayoutManager(this);
        recyclerView.setLayoutManager(layoutManager);
        adapter = new RecycleAdapter(null);
        getImage();
        recyclerView.setAdapter(adapter);
        adapter.openLoadAnimation(BaseQuickAdapter.SLIDEIN_RIGHT);
        adapter.isFirstOnly(false);
    }

    private void getImage() {
        for (int i =0;i<10;i++){
            ImageDTO a = new ImageDTO(R.drawable.iu);
            adapter.addData(a);
        }
    }
}
